home *** CD-ROM | disk | FTP | other *** search
- 'Script to test for adding graphics to the drawing
-
- Option Explicit
-
- Dim TORADIANS
- Dim tcApp
-
- '================= Add graphic the tail of collection
- Sub AddTail(tcGrs)
-
- Dim tcGr
- Set tcGr = tcGrs.AddArcCenterAndPoint(0, 0, 0, 1, 1, 0, 0, 90 * TORADIANS)
- tcGr.Properties("PenColor") = RGB(0, 0, 255)
-
- MsgBox "Graphics count: " & CStr(tcGrs.Count) & " Graphic added to the " & CStr(tcGr.Index)
-
- end sub
-
- '================= Add graphic the head of collection
- Sub AddHead(tcGrs)
-
- Dim tcGr
- Set tcGr = tcGrs.AddArcCenterAndPoint(2, 2, 0, 1, 1, 0, -180 * TORADIANS, -90 * TORADIANS)
- tcGr.Properties("PenColor") = RGB(255, 0, 0)
-
- tcGrs.Remove tcGr.Index
-
- tcGrs.AddGraphic tcGr, 0
- MsgBox "Graphics count: " & CStr(tcGrs.Count) & " Graphic added to the " & CStr(tcGr.Index)
-
- end sub
-
- '================= Add graphic the middle of collection
- Sub AddMiddle(tcGrs)
- Dim tcGr
- Set tcGr = tcGrs.AddArcCenterAndPoint(1, 0, 0, 1, 1, 0, 90 * TORADIANS, 180 * TORADIANS)
- tcGr.Properties("PenColor") = RGB(0, 255, 0)
-
- tcGrs.Remove tcGr.Index
-
- tcGrs.AddGraphic tcGr, 1
- MsgBox "Graphics count: " & CStr(tcGrs.Count) & " Graphic added to the " & CStr(tcGr.Index)
- end sub
-
- Sub Main()
-
- Dim cnt
- Dim tcDwgs
- Dim tcDwg
- Dim tcGrs
-
- Set tcDwgs = tcApp.Drawings
- cnt = tcDwgs.Count
- MsgBox "Drawings count: " & CStr(cnt)
-
- If (cnt = 0) Then
- Exit Sub
- End If
-
- Set tcDwg = tcApp.ActiveDrawing
- Set tcGrs = tcDwg.Graphics
-
- MsgBox "Graphics count: " & CStr(tcGrs.Count)
-
- AddTail tcGrs
-
- AddHead tcGrs
-
- AddMiddle tcGrs
-
- tcDwg.ActiveView.Refresh
- end sub
-
- TORADIANS = 3.14159265358979 / 180
- Set tcApp = CreateObject("TurboCAD.Application")
-
- Main
-
- MsgBox "Done"
-